#include <iostream>
#include <fstream>
#include <vector>
#include <chrono>
using namespace std;
using namespace std::chrono;

void sort_n(vector<int>& data_n) {
    bool fl = true;
    while (fl) {
        fl = false;
        for (int i = 0; i < data_n.size() - 1; i++) {
            if (data_n[i] > data_n[i + 1]) {
                swap(data_n[i], data_n[i + 1]);
                fl = true;
            }
        }
    }
}

vector<int> read_f(const string& file) {
    ifstream infile(file);
    vector<int> data_n;
    int num;
    while (infile >> num) {
        data_n.push_back(num);
    }
    return data_n;
}

void time_m(const string& mm) {
    vector<int> step_1 = read_f(mm);
    auto time_start = high_resolution_clock::now();
    sort_n(step_1);
    auto time_finish = high_resolution_clock::now();
    auto duration = duration_cast<milliseconds>(time_finish - time_start);
    cout << mm << " " << duration.count() << " milliseconds" << endl;
}

int main() {
    time_m("m2_reverse.txt");
    time_m("m1_sorted.txt");
    time_m("m3_shuffle.txt");
    return 0;
}
